function debounce(fn, delay) {
  let t = null;
  return function () {
    if (t !== null) clearInterval(t);
    t = setTimeout(function () {
      fn.call(this);
    }, delay);
  };
}

function throltte(fn, delay) {
  let flag = true;
  return function () {
    if (flag) {
      setTimeout(function () {
        fn.call(this);
        flag = true;
      }, delay);
    }
    flag = false;
  };
}